{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "pd.set_option('display.max_columns', None) # 显示完整的列\n",
    "# pd.set_option('display.max_rows', None) # 显示完整的行\n",
    "# pd.set_option('display.expand_frame_repr', False) # 设置不折叠数据\n",
    "# pd.set_option('display.max_colwidth', 100)\n",
    "\n",
    "df = pd.read_csv('./1++数据.csv')\n",
    "# df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "# df.drop_duplicates(subset=['pid'],keep='first',inplace=True)\n",
    "# df.drop_duplicates(subset=['raw_title'],keep='first',inplace=True)\n",
    "df.drop_duplicates(subset=['detail_url'],keep='first',inplace=True)\n",
    "\n",
    "# df.columns.to_list()\n",
    "df = df[['raw_title', 'detail_url','view_price','view_fee','item_loc','view_sales','comment_count','user_id','nick','icon','comment_url','shopLink','shopcard.isTmall']]\n",
    "# df['view_sales'] = df['view_sales'].str.replace('万','0000').str.strip('人收货').str.strip('+').apply(pd.to_numeric)\n",
    "df['view_sales'] = df['view_sales'].str.replace('万','0000').str.strip('人收货').str.strip('+').astype(int)\n",
    "df['icon'] = df['icon'].str.findall(\"'innerText': '(.*?)'\",)\n",
    "df.to_csv('淘宝_新疆杏销售数据2.csv',index=False)"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "c3ac3f88986c03f5f4ea9b167d463bfb61b25cb597313235fabe727a0f7e0da2"
  },
  "kernelspec": {
   "display_name": "Python 3.9.5 64-bit ('base': conda)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.5"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
